<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/layuiadmin/style/admin.css" media="all">
<body layadmin-themealias="default" style="">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item" style="height: 20px;line-height: 20px;">
                <div class="layui-inline" style="margin-right: 0px;">
                     <span class="layui-breadcrumb">
                        <a href="">首页/用户管理</a>
                        </span>
                </div>
                <div class="layui-inline" style="right: 0px;position: absolute;">
                    <a class="layui-btn layui-btn-small" style="line-height:20px;margin-top:-6px;float:right" href="javascript:location.replace(location.href);" title="刷新">
                        &nbsp;<i class="layui-icon layui-icon-refresh-3" style="line-height:18px;left: 12px;top:12px;"></i>&nbsp;
                    </a>
                </div>
            </div>
        </div>
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline" style="margin-right: 0px;">
                    <label class="layui-form-label">ID</label>
                    <div class="layui-input-inline">
                        <input type="number" name="gameid"  placeholder="游戏ID"  class="layui-input">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="nikename" placeholder="会员名称"  class="layui-input" >
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="phonenum" placeholder="手机号码"  class="layui-input"  style="width:200px;">
                    </div>
                </div>
                <?php if(!strpos(",".$_SESSION["ltq_game_admin_user"]['power'], "3012")){ ?>
                <div class="layui-inline">
                    <label class="layui-form-label">充值金额</label>
                    <div class="layui-input-inline">
                        <input type="number" name="rechargest" placeholder="开始"  class="layui-input"  style="width:200px;">
                    </div>
                    <div class="layui-form-mid">&nbsp;&nbsp;-</div>
                    <div class="layui-input-inline">
                        <input type="number" name="rechargend" placeholder="结束"  class="layui-input">
                    </div>
                </div>
                <?php } ?>
                <div class="layui-inline" style="margin-right: 0px;">
                    <div class="layui-input-inline">
                        <select name="status">
                            <volist name="selects" id="vo">
                                <if condition="$vo.id eq 3">
                                    <option value='{$vo.id}'  selected>{$vo.name}</option>
                                    <else />
                                    <option value='{$vo.id}' >{$vo.name}</option>
                                </if>
                            </volist>
                        </select>
                    </div>
                </div>

                <div class="layui-inline" style="margin-right: 0px;">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit="" lay-filter="LAY-user-back-search">
                        搜索
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table class="layui-table" lay-filter="admin_table" lay-data="{url:'/Member/getsearch',page:true,id:'admin_table',title: '用户管理',limit:90}">
                <thead>

                    <th lay-data="{field: 'nickname',  width:170,toolbar: '#table-nickname'}">登录账号</th>
                    <th lay-data="{field: 'gameid', width:120,sort:true, align:'center'}">游戏ID</th>
                    <th lay-data="{field: 'recharge',width:120}">充值金额</th>
                    <th lay-data="{field: 'winscore',width:120}">盈亏</th>
                    <if condition="$_SESSION['ltq_game_admin_user']['power'] eq 'all'">
                        <th lay-data="{field: 'phonenum',width:120}">电话号码</th>
                    </if>
                    <th lay-data="{field: 'score', width:140}">现金数量</th>
                    <th lay-data="{field: 'goldnum', width:140}">提现数量</th>
                    <th lay-data="{field: 'right', align:'center', maxWidth:220,toolbar: '#table-useradmin-admin'}">操作</th>
                </thead>
            </table>

            <script type="text/html" id="table-nickname">
                <a  onclick="openWin( {{d.gameid }},'mycenter')" style="color: #3f3f3f;" >
                    {{# if(d.usertype ==3){ }}
                    <strong style="display:block"><u>{{d.nickname}}</u>
                        &nbsp;&nbsp;<i class='layui-icon layui-icon-senior' style="color: red;"></i>
                        <span style="color: #c5c5c5;font-size: 0.7em">推广</span></strong>

                    {{# } else if(d.usertype == 4) { }}
                    <span style="color: #0fa117"><u>{{d.nickname}}</u>&nbsp;<i class='layui-icon layui-icon-face-smile' style="color: red;"></i>&nbsp;<span style="color: #c50303;font-size: 0.7em">测试</span></span>
                    {{# } else { }}
                    <span style="color: #0359ff"><u>{{d.nickname}}</u></span>
                    {{# } }}
                </a>
            </script>
            <script type="text/html" id="table-useradmin-admin">
                <a class="layui-btn layui-bg-orange layui-btn-sm"  lay-event="recharge">充值信息</a>
                <a class="layui-btn layui-btn-normal layui-btn-sm"  lay-event="info">游戏信息</a>
                <a class="layui-btn layui-btn-danger layui-btn-sm"  lay-event="details">游戏详情</a>
                <?php if($canshu == '1') {?>
                      {{#  if(d.usertype != 4) { }}
                        <a class="layui-btn layui-bg-cyan layui-btn-sm"  lay-event="test">设置成测试号</a>
                      {{# } }}
                <?php }?>
            </script>
        </div>
    </div>
</div>

<script src="__PUBLIC__/layuiadmin/layui/layui.js"></script>
<script>
    function openWin(gameid,url) {
        layer.open({
            type: 2,
            title: '信息详情',
            shadeClose: true,
            shade: 0.8,
            maxmin: true,
            area: ['70%', '60%'],
            content: '/member/'+url+'?gameid='+gameid //iframe的url
        });
    }
    layui.config({
        base: '__PUBLIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;

        $(".layuiadmin-btn-admin").on("click",function(){
            var gameid = $("input[name=gameid]").val();
            var nikename = $("input[name=nikename]").val();
            var rechargest = $("input[name=rechargest]").val();
            var phonenum = $("input[name=phonenum]").val();
            var status = $("select[name=status]").val();
            var rechargend = $("input[name=rechargend]").val();

            table.reload('admin_table',{
                page:{
                    curr:1
                }
                ,where:{gameid:gameid,nikename:nikename,status:status,rechargest:rechargest,rechargend:rechargend,phonenum:phonenum}
            });
        });
        //监听行工具事件
        table.on('tool(admin_table)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'recharge'){
                var id = '';
                id = obj.data.gameid;
                layer.msg('正在加载，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                        layer.open({
                            type: 2,
                            title:'充值信息',
                            skin: 'layui-layer-rim', //加上边框
                            area: ['60%', '60%'], //宽高
                            maxmin:true,
                            anim:4,
                            content:"/Member/messagebuy?gameid="+id
                        });
                 }});


            } else if(obj.event === 'info'){
                var id = '';
                id = obj.data.gameid;
                layer.msg('正在加载，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                    layer.open({
                        type: 2,
                        title:'游戏信息',
                        skin: 'layui-layer-rim', //加上边框
                        area: ['90%', '90%'], //宽高
                        content:"/Member/gameinfo?gameid="+id
                    });
                }});
            }else if(obj.event==='details'){
                var id = '';
                id = obj.data.gameid;
                layer.msg('正在加载，请稍后。。', {icon: 16,shade:0.5,time:1000,end:function () {
                    layer.open({
                        type: 2,
                        maxmin:true,
                        title:'游戏详情',
                        anim:4,
                        skin: 'layui-layer-rim', //加上边框
                        area: ['90%', '95%'], //宽高
                        content:"/Member/showmessagebunkoall?gameid="+id
                    });
                }});
            }else  if(obj.event==='test'){
                var id = '';
                id = obj.data.gameid;
                $.ajax({
                    type:'get',
                    dataType:"json",
                    url:'gametest?gameid='+id,
                    success:function (data) {
                        if(data['code'] == 1){
                            layer.msg(data['msg'], {icon: 1,end:function () {

                                    layui.table.reload("admin_table");
                                }});
                        }else{
                            layer.msg(data['msg'], {icon: 2,end:function () {

                                    layui.table.reload("admin_table");
                                }});
                        }
                        // layer.clone(index);
                        // layui.table.reload("admin_table");
                    },
                    error:function () {
                        layer.msg('发生错误', {icon: 2});
                    },
                });
            }
        });
    });
</script>
</body>
</html>